package com.huawei.appmarket.service.productpurchase.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.Formatter;
import java.util.Locale;
import o.ewm.h;
import o.ewm.j;

public class CountDownLayout extends LinearLayout {
    private static long ˊ = 60000;
    private static long ˋ = 1000;
    private static long ˎ = 8553600000L;
    private static long ˏ = 3600000;
    private static long ॱ = HwAccountConstants.CHECK_SITE_COUNTRY_DURATION;
    private TextView ʻ;
    private View ʼ;
    private TextView ʽ;
    private TextView ˊॱ;
    private long ˋॱ;
    private long ˏॱ;
    private long ͺ;
    private long ॱˊ;
    private StringBuilder ॱˋ;
    private Formatter ॱˎ;
    private TextView ॱॱ;
    private TextView ᐝ;

    public CountDownLayout(Context context) {
        this(context, null);
    }

    public CountDownLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public CountDownLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ॱ();
        this.ॱˋ = new StringBuilder();
        this.ॱˎ = new Formatter(this.ॱˋ, Locale.getDefault());
    }

    public void ॱ() {
        this.ʼ = LayoutInflater.from(getContext()).inflate(h.ʳ, this);
        this.ᐝ = (TextView) this.ʼ.findViewById(j.ᵢˋ);
        this.ʽ = (TextView) this.ʼ.findViewById(j.ᶡॱ);
        this.ʻ = (TextView) this.ʼ.findViewById(j.ᶥʻ);
        this.ॱॱ = (TextView) this.ʼ.findViewById(j.ᶥʼ);
        this.ˊॱ = (TextView) this.ʼ.findViewById(j.ᶜ);
    }

    public void setPromoteTime(long j) {
        if (j > ˎ || j < 0) {
            setVisibility(4);
            return;
        }
        setVisibility(0);
        this.ॱˊ = j / ॱ;
        if (this.ॱˊ == 0) {
            this.ᐝ.setVisibility(8);
            this.ˊॱ.setVisibility(8);
        } else {
            this.ᐝ.setVisibility(0);
            this.ˊॱ.setVisibility(0);
            this.ᐝ.setText(ˏ(this.ॱˊ));
        }
        long j2 = j % ॱ;
        this.ˋॱ = j2 / ˏ;
        this.ʽ.setText(ˏ(this.ˋॱ));
        j2 %= ˏ;
        this.ˏॱ = j2 / ˊ;
        this.ʻ.setText(ˏ(this.ˏॱ));
        this.ͺ = (j2 % ˊ) / ˋ;
        this.ॱॱ.setText(ˏ(this.ͺ));
    }

    public String ˏ(long j) {
        this.ॱˋ.setLength(0);
        return this.ॱˎ.format("%02d", new Object[]{Long.valueOf(j)}).toString();
    }

    public void setVisibility(int i) {
        super.setVisibility(i);
        if (getChildCount() > 0 && getChildAt(0) != null) {
            if (i == 4) {
                getChildAt(0).setVisibility(8);
            } else {
                getChildAt(0).setVisibility(i);
            }
        }
    }
}
